<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 pro_support_request.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
include $root_path.'common.php';
$page_title = $lang['support_request'];
include $root_path.'page_header.php';

$support_stuff_from_cpanel = <<<EOFpacman
<cpanel SupportRequest="form()">
EOFpacman;


$template->set_filenames(array(
	'body' => $root_path.$template_path.'account/pro_support_request.tpl')
);

//
// Here cpanel has nastly dumped out three pages using one variable. We need to find out what's happened this time, then do stuff as a result.
//

// So, we have the different possibilities...
$redirect_pos = strpos($support_stuff_from_cpanel, "You can enter a support request here:");
$disabled_pos = strpos($support_stuff_from_cpanel, "The System Admin has disabled this feature");
$email_pos = strpos($support_stuff_from_cpanel, "<form action=submitsupport.html");

// Then we need to find out which has happened, and do stuff.
if (!($redirect_pos === false)) {

	$temp = explode('<a href="', $support_stuff_from_cpanel);
	$temp2 = explode('">', $temp['1']);

	// Set the switch for redirecting
	$template->assign_block_vars('switch_redirect', array());

	// And output the URL to the template system.
	$template->assign_vars(array(
		'REDIRECT_URL' => $temp2['0'],
	));

} else if (!($disabled_pos === false)) {

	// All we need to do here is set the disabled switch...
	$template->assign_block_vars('switch_disabled', array());

} else if (!($email_pos === false)) {

	//
	// As far as I can see, all we need in the code is the current email address an
	// the URL to pass the info to...
	//

	$template->assign_block_vars('switch_email', array());
	
	$template->assign_vars(array(
		'CURRENT_EMAIL' => '<cpanel CustInfo="getemail()">',
		'S_ACTION' => 'pro_support_request_done.php',

		'L_SUPPORT_REQUEST_INTRO' => $lang['support_request_intro'],
		'L_FROM' => $lang['from'],
		'L_SUBJECT' => $lang['subject'],
		'L_BODY' => $lang['body'],
		'L_CHANGE_CONTACT_EMAIL' => $lang['change_contact_email'],
		'L_SEND_SUPPORT_REQUEST' => $lang['send_support_request'],
	));

} else {
	message_die("Something wierd happened. Please poke someone to fix it...");
};

$template->assign_vars(array(
	'L_SUPPORT_REQUEST' => $lang['support_request'],
	'L_SUPPORT_REQUEST_DISABLED' => $lang['support_request_disabled'],
	'L_SUPPORT_REQUEST_REDIRECT' => $lang['support_request_redirect'],
));

//
// Woohoo! All done!
//
$template->pparse('body');


include $root_path.'page_tail.php';




?>